package se.webbzon.oschi01.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.border.Border;

import se.webbzon.oschi01.command.History;
import se.webbzon.oschi01.command.UndoableClipboard;
import se.webbzon.oschi01.singleton.Singleton;
import se.webbzon.oschi01.utils.ColorUtils;

public class MainFrame extends JFrame implements Singleton {
	
	private MainModel model;
	
	private WorldPanel regionPanel;
	
	private MainMenuBar mainMenuBar;
	
	private MainFrame() {
		model = new MainModel(new History(), new UndoableClipboard("main"));
		getContentPane().setLayout(new BorderLayout(1,1));
		Border border = BorderFactory.createLineBorder(Color.gray);
	
		JLabel label = new JLabel("C:\\Program\\...\\world");
		label.setBorder(BorderFactory.createLoweredBevelBorder());
		add(label, BorderLayout.NORTH);

		
		mainMenuBar = new MainMenuBar(model);
		regionPanel = new WorldPanel(model);
		regionPanel.setBorder(border);
		
		setJMenuBar(mainMenuBar);
		
		JTabbedPane pane = new JTabbedPane();
		pane.addTab("World",regionPanel);
		
		add(pane,BorderLayout.WEST);
		JDesktopPane desktop = new JDesktopPane();
		desktop.setBorder(border);
		desktop.setBackground(ColorUtils.honeydew3);
		desktop.setPreferredSize(new Dimension(640,480));
		add(desktop, BorderLayout.CENTER);
		
		add(new JLabel("Minecraft Map Modifer (c) 2014 Haffy Entertainment"), BorderLayout.SOUTH);
		pack();
	}
	
	public MainModel getModel() {
		return model;
	}

}
